/**
 * 
 */
var Home = (function(){
	
	function deleteCookie(name) {
        var date = new Date();
        date.setTime(date.getTime() - 10000); //删除一个cookie，就是将其过期时间设定为一个过去的时间
        document.cookie = name + "=删除" + "; expires=" + date.toUTCString();
    }
	
	function initSelectedMenu(){
		// 判断是否为登录进来 是:删除cookie
		if(window.location.hash == '#/index'){
			deleteCookie("menuId");
		}
		var cookieArray = document.cookie.split("; ");
	    for(var i=0;i < cookieArray.length; i++){
	        var aCrumb = cookieArray[i].split("=");
	        if ("menuId" == aCrumb[0]){
	        	// 选中菜单
	        	var _currEleA = $("#"+aCrumb[1]);
	        	var _currEleLi = _currEleA.parent();
				_currEleLi.siblings().removeClass("active");
				_currEleLi.siblings().children().removeClass("selected");
				_currEleLi.addClass("active");
				_currEleA.addClass("selected");
	        }
	    }
	}
	
	return {
		initSelectedMenu : function(){
			initSelectedMenu();
		}
	}
	
})();